package cn.jcet.mapreduce.sort2;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * @author 鲜磊
 * @Date 2020/12/12 22:33
 */
public class ProvicerPartitioner extends Partitioner<Text,FlowBean2> {
    @Override
    public int getPartition(Text key, FlowBean2 value, int i) {

        String perNum = key.toString().substring(0, 3);

        int partitioner = 4;

        if ("136".equals(perNum)){
            partitioner = 0;
        }else if ("137".equals(perNum)){
            partitioner = 1;
        }else if ("138".equals(perNum)){
            partitioner = 2;
        }else if ("139".equals(perNum)){
            partitioner = 3;
        }

        return partitioner;
    }
}
